package util;

import javax.servlet.http.HttpServletRequest;

import servlet.ServletController;

public class CSSDisplay {
	
	//Function which calls for register and password forgotten
	public static String getAction(String type, String value, HttpServletRequest request) {   
		String action = "";
		action = (String) request.getParameter(type);
		if (action.equals(value)) {
		    return "display:block";
		}
	    return "display:none";
	}

	//---------------------------------------------
	//All functions below are used in files .jsp 
	//----------------------------------------------
	//To display error message
	public static String getStyleOf(String message, HttpServletRequest request) {   
		String value = "";
		value = (String) request.getAttribute(message);
		if (value != null) {
		    return "display:block";
		}
	    return "display:none";
	}

	//to select value of parameter
	public static String getSelectedOf(String para, String value, HttpServletRequest request){
		if ((request.getParameter(para) != null) && (request.getParameter(para).equals(value)))
			return "selected";
		return "";
	}
	
	//to display value of parameter
	public static String getValueOf(String para, HttpServletRequest request) {
		if (request.getParameter(para) != null)
			return request.getParameter(para);
		return "";
	}
}
